using System;
using Oracle.ManagedDataAccess.Client;
using OracleInternal.Common;

namespace OracleInternal.TTC
{
	internal class TTCMessage
	{
		internal const byte TTIPRO = 1;

		internal const byte TTIDTY = 2;

		internal const byte TTIFUN = 3;

		internal const byte TTIOER = 4;

		internal const byte TTIRXH = 6;

		internal const byte TTIRXD = 7;

		internal const byte TTIRPA = 8;

		internal const byte TTISTA = 9;

		internal const byte TTIIOV = 11;

		internal const byte TTISLG = 12;

		internal const byte TTIOAC = 13;

		internal const byte TTILOBD = 14;

		internal const byte TTIWRN = 15;

		internal const byte TTIDCB = 16;

		internal const byte TTIPFN = 17;

		internal const byte TTIFOB = 19;

		internal const byte TTIBVC = 21;

		internal const byte TTISPF = 23;

		internal const byte TTIONEWAYFN = 26;

		internal const byte TTIIMPLRES = 27;

		internal const byte TTIRENEG = 28;

		internal const byte OCQCINV = 1;

		internal const byte OCOSPID = 2;

		internal const byte OCTRCEVT = 3;

		internal const byte OCSESSRET = 4;

		internal const byte OCSSYNC = 5;

		internal const byte OCXSSS = 6;

		internal const byte OCLTXID = 7;

		internal const byte OCAPPCONTCTL = 8;

		internal const byte OCXSSS2 = 9;

		internal const byte MAX_OCFN = 7;

		internal byte m_ttcCode;

		internal MarshallingEngine m_marshallingEngine;

		internal TTCMessage(MarshallingEngine marshallingEngine, byte ttcCode)
		{
			m_marshallingEngine = marshallingEngine;
			m_ttcCode = ttcCode;
		}

		internal void WriteTTCCode()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)131328, OracleTraceClassName.TTCMessage, OracleTraceFuncName.WriteTTCCode);
			}
			try
			{
				m_marshallingEngine.MarshalUB1(m_ttcCode);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268566528, OracleTraceClassName.TTCMessage, OracleTraceFuncName.WriteTTCCode, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)131584, OracleTraceClassName.TTCMessage, OracleTraceFuncName.WriteTTCCode);
				}
			}
		}

		internal virtual void ReInit(MarshallingEngine marshallingEngine)
		{
			m_marshallingEngine = marshallingEngine;
		}
	}
}
